﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    namespace="AcademicPlanner.Data.Entities" assembly="AcademicPlanner.Data">

	<class name="PersonEntity" table="people">
		<id name="Id" type="Int32" column="id" unsaved-value="0">
			<generator class="identity"/>
		</id>

		<property name="Name" />
		<property name="Email" unique="true" not-null="true" />
		<property name="Date_Added" not-null="true" />
		<property name="Trashed" not-null="true" />

		<bag name="AccountEntities" cascade="all" order-by="Date_Added" inverse="false">
			<key column="person_id"/>
			<one-to-many class="AccountEntity"/>
		</bag>
	</class>

	<query name="PersonEntity.by.email">
		<![CDATA[
		from PersonEntity as p
		where p.Email = :email
			and p.Trashed = 0
		]]>
	</query>

</hibernate-mapping>
